/**
 * There are <a href="https://www.hdzhx.com">邯郸智讯</a> code generation
 */
package com.boxin.ims.modules.momarketing.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.validator.constraints.Length;

import com.thinkgem.jeesite.common.persistence.BaseEntity;
import com.thinkgem.jeesite.modules.sys.entity.User;

/**
 * 自定义网页Entity
 * @author Jakemanse
 * @version 2014-03-21
 */
@Entity
@Table(name = "ims_custom_page")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class CustomPage extends BaseEntity {
	
	/**
	 * 普通
	 */
	public final static String PAGE_TYPE_NOMAL = "1";
	/**
	 * 签到
	 */
	public final static String PAGE_TYPE_SIGNUP = "2";
	/**
	 * 广告
	 */
	public final static String PAGE_TYPE_ADVERT = "3";
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private User user; 		// 用户
	private String name; 	// 名称
	private String content;		//网页内容
	private String type;		//页面业务类型 1:正常网页     2:签到      3:广告
	private Integer adTimeout;	//要求展示的广告时长
	private String picname;		//封面图片名称
	private Integer score;		//获得的积分(需除以一千，一个积分等于1元)
	private String buttonName;	//按钮名称
	private Integer repeatCount;	//允许重复次数
	
	
	
	private Date createTime;	// 创建日期

	public CustomPage() {
		this.createTime = new Date();
	}

	public CustomPage(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_momarketing_customPage")
	//@SequenceGenerator(name = "seq_momarketing_customPage", sequenceName = "seq_momarketing_customPage")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name="user_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	@Length(min=1, max=200)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	
	@NotNull
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Integer getAdTimeout() {
		return adTimeout;
	}

	public void setAdTimeout(Integer adTimeout) {
		this.adTimeout = adTimeout;
	}

	public Integer getScore() {
		return score;
	}

	public void setScore(Integer score) {
		this.score = score;
	}

	public Integer getRepeatCount() {
		return repeatCount==null ? 0:repeatCount;
	}

	public void setRepeatCount(Integer repeatCount) {
		this.repeatCount = repeatCount;
	}

	public String getButtonName() {
		return buttonName;
	}

	public void setButtonName(String buttonName) {
		this.buttonName = buttonName;
	}

	public String getPicname() {
		return picname;
	}

	public void setPicname(String picname) {
		this.picname = picname;
	}


	
	
	
	

	
}


